<?php


namespace App\Http\Requests\ApiV2;

use Illuminate\Support\Facades\Auth;
use App\Services\Member\Interfaces\UserServiceInterface;
use App\Services\Member\Services\UserService;


class FamilyMemberRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'nick_name' => 'required',
            'avatar' => 'required',



        ];
    }

    public function messages()
    {
        return [
            'nick_name.required' => __('请输入孩子的名字'),
            'avatar.required' => __('请上传孩子的照片'),

        ];
    }

    public function filldata()
    {
        /**
         * @var $userService $UserService
         */

        $avatar = $this->input('avatar');
        $nickName = $this->input('nick_name');


        $userService = app()->make(UserServiceInterface::class);
        $user = $userService->createWithoutMobile($avatar, $nickName );


        return [
            'user_id' => $user['id'],
        ];

    }
}
